# # 使用最短路径算法为每对节点确定固定路由
# from collections import defaultdict
#
# from networkx import nodes
#
#
# def dijkstra_paths(graph, weight='hops'):
#     # 实现代码参考NetworkX库
#     paths = {
#         ('A', 'B'): ['A', 'B'],
#         ('A', 'C'): ['A', 'B', 'C'],
#         ('B', 'A'): ['B', 'A'],
#         ('B', 'C'): ['B', 'C'],
#         ('C', 'A'): ['C', 'A'],
#         ('C', 'B'): ['C', 'A', 'B']
#     }
#     return paths
#
# # 统计每条链路的负载
# link_load = defaultdict(float)  # key: (u,v), value: 总流量(MB)
#
# for src in nodes:
#     for dst in nodes:
#         if src == dst:
#             continue
#         path = get_path(src, dst)
#         for u, v in zip(path[:-1], path[1:]):
#             link = tuple(sorted((u, v)))  # 无向边处理
#             link_load[link] += traffic_matrix[src][dst]
#
# # 示例输出
# {
#     ('A', 'B'): 500+200+600 = 1300 MB,
#     ('B', 'C'): 300+400 = 700 MB,
#     ('A', 'C'): 100+200 = 300 MB
# }
#
# # 计算传输时延
